package com.hlg.xboot.enums;

/**
 * <p>Description:上传的资源类型</p>
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: 中视数讯</p>
 * <p>Site: www.digi-zones.com</p>
 *
 * @author 杨信
 * @version 1.0
 * @date 2016/11/25
 */
public enum ResourceType {

    IMAGE("images", 1), AUDIO("audios", 2), VIDEO("videos", 3), PDF("pdfs", 4), WORK("words", 5), EXCEL("excels", 6),
    FILE("files", 99);

    private String desc;
    private Integer value;

    ResourceType(String desc, int value) {
        this.desc = desc;
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public static ResourceType getResourceType(Integer value) {
        ResourceType ResourceType = null;
        ResourceType[] enumAry = ResourceType.values();
        for (int i = 0; i < enumAry.length; i++) {
            if (enumAry[i].getValue() == value) {
                ResourceType = enumAry[i];
                break;
            }
        }
        return ResourceType;
    }
}
